import 'package:flutter/material.dart';
import 'package:flutter_demo/ui/pages/status/inherited/trans/b_page_widget.dart';
import 'package:flutter_demo/ui/pages/status/inherited/trans/share_widget.dart';

class APageWidget extends StatefulWidget {
  const APageWidget({super.key});

  @override
  State<APageWidget> createState() => _APageWidgetState();
}

class _APageWidgetState extends State<APageWidget> {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Center(
          child: Text("${ShareWidget.of(context)?.nickname}"),
        ),
        SizedBox(
          height: 20,
        ),
        ElevatedButton(
          onPressed: () {
            debugPrint(ShareWidget.of(context)?.nickname);
          },
          child: Text("A页面:获取B页面修改的值"),
        ),
        ElevatedButton(
          onPressed: () {
            Navigator.push(context, MaterialPageRoute(builder: (context) {
              return BPageWidget();
            }));
          },
          child: Text("A页面:使用路由情况跳转B"),
        ),
      ],
    );
  }
}
